<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <jsp:include page="../header.jsp"></jsp:include>
</head>

<body>
<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 class="mui-title">预约安装</h1>
</header>
<jsp:include page="../commonMenu.jsp"></jsp:include>

<div class="mui-content">
    <c:forEach items="${bookList}" var="vo">
        <div class="mui-card">
            <div class="mui-card-header">
                <span class="mui-text-left">
                    <fmt:formatDate value="${vo.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                </span>
            </div>
            <div class="mui-card-content">
                <div class="mui-card-content-inner">
                    <ul class="mui-table-view">
                        <li class="mui-table-view-cell">
                            代理商ID：${vo.distributorId}
                        </li>
                        <li class="mui-table-view-cell">
                            用户姓名：${vo.distributorName}
                        </li>
                        <li class="mui-table-view-cell">
                            电话：${vo.tel}
                        </li>
                        <li class="mui-table-view-cell">
                            设备型号：${vo.devType}
                        </li>
                        <li class="mui-table-view-cell">
                            预约时间：<fmt:formatDate value="${vo.bookTime}" pattern="yyyy-MM-dd"></fmt:formatDate>
                        </li>
                        <li class="mui-table-view-cell">
                            安装地址：${vo.address}
                        </li>
                    </ul>
                </div>
            </div>
            <div class="mui-card-footer">
                &nbsp;
                <span class=" mui-text-right">
                    <span class="mui-text-right mui-btn-danger">
                    <c:choose>
                        <c:when test="${vo.status eq 1}">
                            已处理
                        </c:when>
                        <c:otherwise>
                            <button class="mui-btn" onclick="deal('${vo.id}')">点击处理</button>
                        </c:otherwise>
                    </c:choose>
                </span>
                </span>
            </div>
        </div>
    </c:forEach>
</div>
</body>
<jsp:include page="../footer.jsp"></jsp:include>
<script src="${pageContext.request.contextPath}/static/mui/js/echarts-all.js"></script>
<script>
    function deal(id) {
        $.ajax({
            url: "/distributor/book/deal?id=" + id,
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    mui.toast("处理成功");
                } else {
                    mui.toast("处理失败");
                }
            }
        })
    }
</script>
</html>